<!DOCTYPE html>
<html>
<head>
	<title>Arab商户登录</title>
	<meta charset="utf-8">
	<script type="text/javascript" src="/static/jquery.js"></script>
</head>
<body>
	账号：<input type="text" class="account" value='jslog'><br><br>
	密码：<input type="text" class="passwd" value='123456'><br><br>
	验证码：<input type="text" class="captcha" value=''><span><img id='captcha_img' src='' width="60%"></span>
	<input type="hidden" class="captcha_id" value=''>
	<button onclick="login()">提交</button><br><br>
</body>

<script type="text/javascript">
	let domain = "http://127.0.0.1:8080"
	function getcaptcha(){
		$.ajax({
		   	type: "POST",
		   	url: domain+"/share/captcha/graphic_captcha",
		   	data: "",
		   	success: function(msg){
		   		$('.captcha_id').val(msg.data.code_id)
		   		$('#captcha_img').prop('src', domain+msg.data.path)
		   		console.log(domain+msg.data.path)
		   		console.log(msg.data.code_id)
		   	}
		});
	}
	getcaptcha()

	function login(){
		let account = $('.account').val()
		let passwd = $('.passwd').val()
		let captchaId = $('.captcha_id').val()
		let captcha = $('.captcha').val()
		let data = {
			account:account,
			passwd:passwd,
			captcha_id:captchaId,
			captcha:captcha,
		}
		$.ajax({
		   	type: "POST",
		   	url: domain+"/share/merchant/login",
		   	data: data,
		   	success: function(msg){
		   		console.log(msg.data)
		   	}
		});
	}
</script>
</html>